﻿using UnityEngine;
using System.Collections;

public class EnemySpawner : MonoBehaviour 
{
	public Transform enemies;
	public float x;
	public float y;
	public float m_Time = 5;
	public float cooldown = 0;
	
	void Start() 
	{
		
			
	}
	
	void Update()
	{
		Spawn();
	}	
	
	void Spawn()
	{
		 if (cooldown > 0)
		 {
				cooldown -=Time.deltaTime;
			
		 }
		 else
		 {
			Instantiate(enemies, new Vector3(x, y, 0), Quaternion.identity);
			cooldown = m_Time;
		 }
		
	}
}
